﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.Imaging;
using System.IO.IsolatedStorage;

namespace myChannel9
{
    public partial class Control_Show : UserControl
    {
        public event EventHandler goToShow;

        public Control_Show()
        {
            InitializeComponent();

            genereateShowList();
        }

        private void genereateShowList()
        {
            //Web Camps TV

            List<ShowObject> list1 = new List<ShowObject>();
            list1.Add(new ShowObject { Heading = "this week", Image = "Images/Show_ThisWeek.png", Querry = "This Week On Channel 9" , Rss = "http://channel9.msdn.com/Shows/This+Week+On+Channel+9/RSS"});
            list1.Add(new ShowObject { Heading = "Defrag", Image = "Images/Show_TheDefragShow.png", Querry = "Defrag", Rss = "http://channel9.msdn.com/Shows/The-Defrag-Show/RSS" });
            list1.Add(new ShowObject { Heading = "hot apps", Image = "Images/Show_HotApps.png", Querry = "Hot Apps", Rss = "http://channel9.msdn.com/Shows/Hot-Apps/RSS"});
            list1.Add(new ShowObject { Heading = "ping!", Image = "Images/Show_Ping.png", Querry = "Ping!", Rss = "http://channel9.msdn.com/Shows/PingShow/RSS" });
            list1.Add(new ShowObject { Heading = "arcast tv", Image = "Images/Show_ArcastTV.png", Querry = "ARCast.TV", Rss = "http://channel9.msdn.com/Shows/ARCast.TV/RSS" });
            list1.Add(new ShowObject { Heading = "inside out", Image = "Images/Show_InsideOut.png", Querry = "Inside Out", Rss = "http://channel9.msdn.com/Shows/Inside+Out/RSS" });
            list1.Add(new ShowObject { Heading = "knowledge", Image = "Images/Show_KnowledgeChamber.png", Querry = "The Knowledge Chamber", Rss = "http://channel9.msdn.com/Shows/The+Knowledge+Chamber/RSS" });
            list1.Add(new ShowObject { Heading = "behind code", Image = "Images/Show_BehindTheCode.png", Querry = "Behind The Code", Rss = "http://channel9.msdn.com/Shows/Behind+The+Code/RSS" });
            list1.Add(new ShowObject { Heading = "cloud cover", Image = "Images/Show_CloudCover.png", Querry = "Cloud Cover", Rss = "http://channel9.msdn.com/Shows/Cloud+Cover/RSS" });
            list1.Add(new ShowObject { Heading = "geek speak", Image = "Images/Show_GeekSpeak.png", Querry = "geekSpeak", Rss = "http://channel9.msdn.com/Shows/geekSpeak/RSS" });
            list1.Add(new ShowObject { Heading = "hpc show", Image = "Images/Show_Default.png", Querry = "The HPC Show", Rss = "http://channel9.msdn.com/Shows/The+HPC+Show/RSS" });
            list1.Add(new ShowObject { Heading = "wp7", Image = "Images/Show_Default.png", Querry = "Inside Windows Phone", Rss = "http://channel9.msdn.com/Shows/Inside+Windows+Phone/RSS" });
            list1.Add(new ShowObject { Heading = "developers", Image = "Images/Show_Default.png", Querry = "Developers for Developers", Rss = "http://channel9.msdn.com/Shows/Devs4Devs/RSS" });
            list1.Add(new ShowObject { Heading = "arcast", Image = "Images/Show_Default.png", Querry = "ARCast", Rss = "http://channel9.msdn.com/Shows/ARCast+with+Ron+Jacobs/RSS" });
            list1.Add(new ShowObject { Heading = "10-4", Image = "Images/Show_10-4.png", Querry = "10-4", Rss = "http://channel9.msdn.com/Shows/10-4/RSS" });
            list1.Add(new ShowObject { Heading = "communic.", Image = "Images/Show_Default.png", Querry = "Communicating", Rss = "http://channel9.msdn.com/Shows/Communicating/RSS" });
            list1.Add(new ShowObject { Heading = "vs2010", Image = "Images/Show_VisualStudio2010Launch.png", Querry = "Visual Studio 2010 Launch", Rss = "http://channel9.msdn.com/Shows/VS2010Launch/RSS" });
            list1.Add(new ShowObject { Heading = "toolshed", Image = "Images/Show_Toolshed.png", Querry = "Toolshed", Rss = "http://channel9.msdn.com/Shows/toolshed/RSS" });
            lboShow1.ItemsSource = list1;

            List<ShowObject> list2 = new List<ShowObject>();
            list2.Add(new ShowObject { Heading = "going deep", Image = "Images/Show_GoingDeep.png", Querry = "Going Deep", Rss = "http://channel9.msdn.com/Shows/Going+Deep/RSS" });
            list2.Add(new ShowObject { Heading = "sharepoint", Image = "Images/Show_SharePointSlideshow.png", Querry = "SharePoint Sideshow", Rss = "http://channel9.msdn.com/Shows/SharePointSideshow/RSS" });
            //list2.Add(new ShowObject { Heading = "Hanselminut", Image = "Images/Series_HanselminutesOn9.png", Querry = "Hanselminutes On 9", Rss = "http://channel9.msdn.com/Shows/HanselminutesOn9/RSS" });
            list2.Add(new ShowObject { Heading = "Checking In", Image = "Images/Show_CheckingInWithErikMeijer.png", Querry = "Checking In", Rss = "http://channel9.msdn.com/Shows/Checking-In-with-Erik-Meijer/RSS" });
            list2.Add(new ShowObject { Heading = "DevNuggets", Image = "Images/Show_DevNuggets.png", Querry = "DevNuggets", Rss = "http://channel9.msdn.com/Shows/DevNuggets/RSS" });
            list2.Add(new ShowObject { Heading = "office blog", Image = "Images/Show_OfficeBlog.png", Querry = "The Office Blog", Rss = "http://channel9.msdn.com/Shows/TheOfficeBlog/RSS" });
            list2.Add(new ShowObject { Heading = "endpoint tv", Image = "Images/Show_EndpointTV.png", Querry = "endpoint.tv", Rss = "http://channel9.msdn.com/Shows/Endpoint/RSS" });
            list2.Add(new ShowObject { Heading = "silverlight tv", Image = "Images/Show_SilverlightTv.png", Querry = "Silverlight TV", Rss = "http://channel9.msdn.com/Shows/SilverlightTV/RSS" });
            list2.Add(new ShowObject { Heading = "inside xbox", Image = "Images/Show_InsideXbox.png", Querry = "InsideXbox", Rss = "http://channel9.msdn.com/Shows/InsideXbox/RSS" });
            list2.Add(new ShowObject { Heading = "identity show", Image = "Images/Show_IdentityShow.png", Querry = "The Id Element", Rss = "http://channel9.msdn.com/Shows/Identity/RSS" });
            list2.Add(new ShowObject { Heading = "but why?", Image = "Images/Show_ButWhy.png", Querry = "But Why?", Rss = "http://channel9.msdn.com/Shows/ButWhy/RSS" });
            list2.Add(new ShowObject { Heading = "web camps", Image = "Images/Show_WebCampsTV.png", Querry = "Web Camps TV", Rss = "http://channel9.msdn.com/Shows/Web+Camps+TV/RSS" });
            list2.Add(new ShowObject { Heading = "access show", Image = "Images/Show_Default.png", Querry = "The Access Show", Rss = "http://channel9.msdn.com/Shows/Access/RSS" });
            list2.Add(new ShowObject { Heading = "coding4fun", Image = "Images/Show_Default.png", Querry = "Coding4Fun TV", Rss = "http://channel9.msdn.com/Shows/Coding4FunTV/RSS" });
            list2.Add(new ShowObject { Heading = "techfairsv ", Image = "Images/Show_Default.png", Querry = "TechFairSV", Rss = "http://channel9.msdn.com/Shows/TechFairSV/RSS" });
            list2.Add(new ShowObject { Heading = "continuum ", Image = "Images/Show_TheContinuumShow.png", Querry = "The Continuum Show", Rss = "http://channel9.msdn.com/Shows/Continuum/RSS" });
            list2.Add(new ShowObject { Heading = "wm_in ", Image = "Images/Show_Default.png", Querry = "WM_IN", Rss = "http://channel9.msdn.com/Shows/WM_IN/RSS" });
            lboShow2.ItemsSource = list2;
        }

        private void lboShow1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ShowObject show = lboShow1.SelectedItem as ShowObject;

            if (show != null)
            {
                if (IsolatedStorageSettings.ApplicationSettings.Contains("Show"))
                    IsolatedStorageSettings.ApplicationSettings["Show"] = show;
                else
                    IsolatedStorageSettings.ApplicationSettings.Add("Show", show);

                goToShow(show, new EventArgs());
                lboShow1.SelectedIndex = -1;
            }
        }

        private void lboShow2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ShowObject show = lboShow2.SelectedItem as ShowObject;

            if (show != null)
            {
                if (IsolatedStorageSettings.ApplicationSettings.Contains("Show"))
                    IsolatedStorageSettings.ApplicationSettings["Show"] = show;
                else
                    IsolatedStorageSettings.ApplicationSettings.Add("Show", show);

                goToShow(show, new EventArgs());
                lboShow2.SelectedIndex = -1;
            }
        }

    }
}
